/******************************************************************************/
/* rfile_def.h                                                                */
/******************************************************************************/

#ifndef __RFILE_DEF_H
#define __RFILE_DEF_H


/*********************** Macros & Constants for RFILE *************************/
#define RFILE_RAM_SIZE           (2048)
#define RFILE_QUERY_EN_FLG       (0xAA)


/*********************** Prototypes & struct for RFILE ************************/

#pragma pack(1)
typedef struct
QUERY_SETT_RFILE
{
    QUERY_SETT_RFILE() : isQueryEn(0), key(3), baudRate(9600), slave(0xFF),
                         func(0xFF), addr(0), value(0), msgTimeout(0),
                         byteTimeout(0), retry(0) {}

    uint8_t  isQueryEn;
    uint8_t  key;
    uint32_t baudRate;
    uint8_t  slave;
    uint8_t  func;
    uint16_t addr;
    uint16_t value;
    uint16_t msgTimeout;
    uint16_t byteTimeout;
    uint16_t retry;
    uint8_t  data[64];
} __QUERY_SETT_RFILE;


typedef struct
ANSW_SETT_RFILE
{
    ANSW_SETT_RFILE() : destAddr(0xFFFF), count(0), offset(0xFFFF) {}

    uint16_t destAddr;
    uint16_t count;
    uint16_t offset;
} __ANSW_SETT_RFILE;


typedef struct
{
    __QUERY_SETT_RFILE query;
    __ANSW_SETT_RFILE answ;
} __DIGIT_DEV_SETT;

#pragma pack()



typedef struct
RFILE_DATA
{
    RFILE_DATA() : addr(0), pBuff(0), dataLen(0) {}

    uint32_t addr;
    uint8_t * pBuff;
    uint32_t dataLen;
} __RFILE_DATA;



#endif